//common
export const CALL_API = 'Call_API';
export const ERROR_MESSAGE = 'ERROR_MESSAGE';
export const RESET_ERROR_MESSAGE = 'RESET_ERROR_MESSAGE';

const FieldList = ['request', 'success', 'failure'];
const build = (fields, root, obj = {}, end = false) => fields.reduce((r, f) => Object.defineProperty(r, f, {
    value: end ? `${root}_${f.toUpperCase()}` :
        build(FieldList, `${root.toUpperCase()}_${f.toUpperCase()}`, {types(){return FieldList.map(f => this[f]);}}, true)
}), obj);

export const COMMON = build(['vip', 'id'], 'common');

export const STORE = build([

    'out',
    'edit',
    'inList',
    'outList',

    'accum',
    'accumList',

], 'store');

export const CART = build([

    'list',
    'item',
    'edit',
    'clear',
    'records',
    'exchange',

], 'cart');

export const ACTIVE = build([

    'get',
    'add',
    'edit',
    'ident',
    'distinct',

], 'active');

export const VOUCHER = build([

    'new',
    'used',
    'count',
    'expire',

], 'voucher');




